package com.blog.cmrpersonalblog.dto.auth.response;

import lombok.Data;

/**
 * 邮箱验证响应DTO
 */
@Data
public class EmailVerificationResponse {

    /**
     * 是否成功
     */
    private Boolean success;

    /**
     * 消息
     */
    private String message;

    /**
     * 验证码有效期（分钟）
     */
    private Integer expireMinutes;

    /**
     * 下次可发送时间（秒）
     */
    private Integer nextSendSeconds;

    /**
     * 今日剩余发送次数
     */
    private Integer remainingSendCount;

    public static EmailVerificationResponse success(String message, Integer expireMinutes) {
        EmailVerificationResponse response = new EmailVerificationResponse();
        response.setSuccess(true);
        response.setMessage(message);
        response.setExpireMinutes(expireMinutes);
        return response;
    }

    public static EmailVerificationResponse error(String message) {
        EmailVerificationResponse response = new EmailVerificationResponse();
        response.setSuccess(false);
        response.setMessage(message);
        return response;
    }

    public static EmailVerificationResponse rateLimited(String message, Integer nextSendSeconds, Integer remainingSendCount) {
        EmailVerificationResponse response = new EmailVerificationResponse();
        response.setSuccess(false);
        response.setMessage(message);
        response.setNextSendSeconds(nextSendSeconds);
        response.setRemainingSendCount(remainingSendCount);
        return response;
    }
}

